home *** CD-ROM | disk | FTP | other *** search
/ Programming Microsoft Visual Basic .NET / Programming Microsoft Visual Basic .NET (Microsoft Press)(X08-78517)(2002).bin / 23 web forms and controls / databinding / datagridform.aspx < prev    next >
Encoding:
ASP.NET Web Form  |  2002-03-17  |  3.4 KB  |  61 lines

  1. <%@ Page Language="vb" AutoEventWireup="false" Codebehind="DataGridForm.aspx.vb" Inherits="DataBinding.DataGridForm" trace="False" enableViewState="True" enableViewStateMac="False" %>
  2. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
  3. <HTML>
  4.     <HEAD>
  5.         <title>DataGridForm</title>
  6.         <meta content="Microsoft Visual Studio.NET 7.0" name="GENERATOR">
  7.         <meta content="Visual Basic 7.0" name="CODE_LANGUAGE">
  8.         <meta content="JavaScript" name="vs_defaultClientScript">
  9.         <meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
  10.     </HEAD>
  11.     <body>
  12.         <form id="Form1" method="post" runat="server">
  13.             <H1>DataGrid Control Demo</H1>
  14.             <P>This form demonstrates the main features of the DataGrid control, including 
  15.                 sortable columns, Edit/Delete buttons, custom templates (eg to render the 
  16.                 Publisher foreign value and the More Info column to display a link). You can 
  17.                 modify as many rows you wish, and then perform an update on the real database 
  18.                 (but in this demo no actual update is performed).</P>
  19.             <P> </P>
  20.             <P><asp:datagrid id="dgrTitles" runat="server" Width="596px" Height="177px" AutoGenerateColumns="False" AllowSorting="True" SortExpr="price">
  21.                     <SelectedItemStyle BackColor="Orange"></SelectedItemStyle>
  22.                     <EditItemStyle BackColor="Orange"></EditItemStyle>
  23.                     <AlternatingItemStyle BackColor="Khaki"></AlternatingItemStyle>
  24.                     <HeaderStyle Font-Names="Arial Black" ForeColor="White" BackColor="Black"></HeaderStyle>
  25.                     <FooterStyle ForeColor="Blue"></FooterStyle>
  26.                     <Columns>
  27.                         <asp:TemplateColumn HeaderText="[ ]">
  28.                             <ItemTemplate>
  29.                                 <asp:CheckBox id="chkSelect" runat="server"></asp:CheckBox>
  30.                             </ItemTemplate>
  31.                         </asp:TemplateColumn>
  32.                         <asp:BoundColumn DataField="title" SortExpression="Title" HeaderText="Title"></asp:BoundColumn>
  33.                         <asp:TemplateColumn HeaderText="Publisher">
  34.                             <ItemTemplate>
  35.                                 <asp:Label id=lblPublisher runat="server" Text='<%# Container.DataItem.Row.GetParentRow("PubsTitles")("pub_name") %>'>
  36.                                 </asp:Label>
  37.                             </ItemTemplate>
  38.                             <EditItemTemplate>
  39.                                 <asp:DropDownList id="ddlPublishers" runat="server" Width="181px" DataValueField="pub_id" DataTextField="pub_name"></asp:DropDownList>
  40.                             </EditItemTemplate>
  41.                         </asp:TemplateColumn>
  42.                         <asp:BoundColumn DataField="type" SortExpression="Type" HeaderText="Type">
  43.                             <HeaderStyle Width="80px"></HeaderStyle>
  44.                         </asp:BoundColumn>
  45.                         <asp:BoundColumn DataField="price" SortExpression="Price" HeaderText="Price">
  46.                             <HeaderStyle Width="50px"></HeaderStyle>
  47.                         </asp:BoundColumn>
  48.                         <asp:EditCommandColumn ButtonType="PushButton" UpdateText="Update" HeaderText="Edit" CancelText="Cancel" EditText="Edit"></asp:EditCommandColumn>
  49.                         <asp:ButtonColumn Text="Delete" ButtonType="PushButton" HeaderText="Delete" CommandName="Delete"></asp:ButtonColumn>
  50.                         <asp:HyperLinkColumn Text="Publisher" DataNavigateUrlField="pub_id" DataNavigateUrlFormatString="/showpubs.aspx?pub_id={0}" HeaderText="More info"></asp:HyperLinkColumn>
  51.                     </Columns>
  52.                 </asp:datagrid></P>
  53.             <P><asp:button id="btnEval" runat="server" Text="Eval total for selected titles"></asp:button>   
  54.                 <asp:button id="btnUpdate" runat="server" Text="Update the Pubs Database"></asp:button></P>
  55.             <P><asp:label id="lblTotal" runat="server">[no title is selected]</asp:label></P>
  56.             <P>
  57.             <P> </P>
  58.         </form>
  59.     </body>
  60. </HTML>
  61.